@extends('layouts.app')

@section('title', 'Change Password')

@section('content')
    <div class="container" style="margin-top: 100px">
        <div class="col-lg-8 col-lg-offset-2">

            @if (session('success'))
                <div class="alert alert-dismissible alert-success">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                    <strong>Success</strong> {{session('success')}}
                </div>
            @endif

            @if (session('error'))
                <div class="alert alert-danger">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                    <strong>Error:</strong>
                    <span>{{session('error')}}</span>
                </div>
            @endif
            <form class="form-horizontal" action="{{url('/change/password')}}" method="post">
                <h2 class="text-center">Change Password</h2>
                {{csrf_field()}}
                <div class="form-group {{ $errors->has('old_password') ? ' has-error' : '' }}">
                    <label for="old_password">Old Password</label>
                    <input class="form-control" type="password" name="old_password" id="old_password" required
                           value="{{old('old_password')}}">
                    @if ($errors->has('old_password'))
                        <span class="help-block">
                            <strong>{{ $errors->first('old_password') }}</strong>
                        </span>
                    @endif
                </div>
                <div class="form-group  {{ $errors->has('password') ? ' has-error' : '' }}">
                    <label for="password">New Password</label>
                    <input class="form-control" type="password" name="password" id="password" required
                           value="{{old('password')}}">
                    @if ($errors->has('password'))
                        <span class="help-block">
                            <strong>{{ $errors->first('password') }}</strong>
                        </span>
                    @endif
                </div>
                <div class="form-group">
                    <label for="password_confirmation">Confirm Password</label>
                    <input class="form-control" type="password" name="password_confirmation" id="password_confirmation"
                           required>
                </div>

                <div class="form-group">
                    <button class="btn btn-success" type="Submit">Submit</button>
                </div>
            </form>
        </div>
    </div>
@endsection